import time
from public.action import *
from public.business import *
from public.testData import *
from public.tools import *
testCase="DBshop006_商品管理添加商品流程"
firefox=openBrowser(urlAdmin) #调用函数打开网址
DBshopLoginAdmin(firefox)
DBshopEnterMenu2(firefox,'商品管理','管理商品')
s=firefox.find_element_by_xpath("//body").text
print(s)
l="商品数\："
r="\)"
num1=reGetString(s,l,r)
firefox.find_element_by_partial_link_text('添加商品').click()
firefox.find_element_by_id('goods_name').send_keys('苹果XR')
firefox.find_element_by_id('goods_shop_price').send_keys(7999)
firefox.find_element_by_xpath('//select[@id="goods_type"]/option[3]').click()
firefox.find_element_by_xpath('//button').click()
time.sleep(3)
s=firefox.find_element_by_xpath("//body").text
print(s)
num2=reGetString(s,l,r)
if int(num2)==int(num1)+1:
    writeLog("%s 测试通过" % (testCase))
else:
    writeLog("%s 测试失败" % (testCase))
    getPhoto(firefox)
firefox.quit()